<?php
/**
 * QQAS - share your knowledge to the world!
 *
 * @author		xiaochong0302 <xiaochong0302@gmail.com>
 * @copyright	Copyright (c) 2011, Koogua Studio.
 * @license		http://www.qqas.org/user_guide/license.html
 * @link		http://www.qqas.org
 * @since		Version 1.0
 * @filesource
 */


class WordModel extends Model
{

    public function cacheCensoredWords()
    {
        $words = $this->select();
    	if (!empty($words))
    	{
    		foreach ($words as $value)
    		{
    			$value['word'] = str_replace('\\*', '[^ ]*', preg_quote($value['word']));
                $array['search'][] = '/'. $value['word'] .'/i';
                $array['replace'][] = $value['replacement'];
    		};
    		F('cache_censored_words', $array);
    	}
    }

}

/* End of file WordModel.class.php */
/* Location: ./App/Lib/Model/WordModel.class.php */
